home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / t2win-32 / _serialz.frm (.txt) < prev    next >
Visual Basic Form  |  1998-07-13  |  7KB  |  166 lines

  1. VERSION 5.00
  2. Begin VB.Form frmSerialization 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Serialization"
  5.    ClientHeight    =   4020
  6.    ClientLeft      =   1890
  7.    ClientTop       =   3270
  8.    ClientWidth     =   8340
  9.    MaxButton       =   0   'False
  10.    MDIChild        =   -1  'True
  11.    PaletteMode     =   1  'UseZOrder
  12.    ScaleHeight     =   4020
  13.    ScaleWidth      =   8340
  14.    ShowInTaskbar   =   0   'False
  15.    Begin VB.Frame Frame1 
  16.       Height          =   570
  17.       Left            =   0
  18.       TabIndex        =   1
  19.       Top             =   -90
  20.       Width           =   8310
  21.       Begin VB.CommandButton cmdNP 
  22.          Caption         =   ">"
  23.          Height          =   285
  24.          Index           =   1
  25.          Left            =   7920
  26.          TabIndex        =   6
  27.          Top             =   195
  28.          Width           =   285
  29.       End
  30.       Begin VB.CommandButton cmdNP 
  31.          Caption         =   "<"
  32.          Height          =   285
  33.          Index           =   0
  34.          Left            =   7020
  35.          TabIndex        =   5
  36.          Top             =   195
  37.          Width           =   285
  38.       End
  39.       Begin VB.CommandButton Command1 
  40.          Caption         =   "&Go"
  41.          Default         =   -1  'True
  42.          Height          =   285
  43.          Left            =   7380
  44.          TabIndex        =   4
  45.          Top             =   195
  46.          Width           =   465
  47.       End
  48.       Begin VB.ComboBox cmb_Function 
  49.          Height          =   315
  50.          Left            =   1365
  51.          TabIndex        =   2
  52.          Top             =   180
  53.          Width           =   5565
  54.       End
  55.       Begin VB.Label Label2 
  56.          Caption         =   "&Select a function"
  57.          Height          =   255
  58.          Left            =   90
  59.          TabIndex        =   3
  60.          Top             =   210
  61.          Width           =   1275
  62.       End
  63.    End
  64.    Begin VB.TextBox txt_Result 
  65.       BackColor       =   &H00C0C0C0&
  66.       BorderStyle     =   0  'None
  67.       Height          =   3270
  68.       Left            =   105
  69.       Locked          =   -1  'True
  70.       MultiLine       =   -1  'True
  71.       ScrollBars      =   2  'Vertical
  72.       TabIndex        =   0
  73.       Top             =   630
  74.       Width           =   8100
  75.    End
  76. Attribute VB_Name = "frmSerialization"
  77. Attribute VB_GlobalNameSpace = False
  78. Attribute VB_Creatable = False
  79. Attribute VB_PredeclaredId = True
  80. Attribute VB_Exposed = False
  81. Option Explicit
  82. Option Base 1
  83. Private Const Iteration = 250
  84. Dim IsLoaded         As Integer
  85. Dim TimerStartOk     As Integer
  86. Dim TimerCloseOk     As Integer
  87. Dim TimerHandle      As Integer
  88. Dim TimerValue       As Long
  89. Private Sub cmdNP_Click(Index As Integer)
  90.    Call sub_NextPrev(cmb_Function, Index)
  91. End Sub
  92. Private Sub cmb_Function_Click()
  93.    If (IsLoaded = False) Then Exit Sub
  94.    Call cDisableFI(mdiT2W.Picture1)
  95.    txt_Result = ""
  96.    Select Case cmb_Function.ListIndex
  97.       Case 0
  98.          Call TestSerialization
  99.    End Select
  100.    DoEvents
  101.    Call cEnableFI(mdiT2W.Picture1)
  102. End Sub
  103. Private Sub Form_Activate()
  104.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  105. End Sub
  106. Private Sub Form_Load()
  107.    IsLoaded = False
  108.    Show
  109.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_serialz.t2w")
  110.    IsLoaded = True
  111. End Sub
  112. Private Sub Command1_Click()
  113.    Call cmb_Function_Click
  114. End Sub
  115. Private Sub TestSerialization()
  116.    Dim intResult        As Integer
  117.    Dim strResult        As String
  118.    Dim strDisplay       As String
  119.    Dim i                As Integer
  120.    Dim j                As Integer
  121.    Dim getSD            As tagSERIALDATA
  122.    Dim putSD            As tagSERIALDATA
  123.    Dim File1            As String
  124.    Dim File2            As String
  125.    strResult = ""
  126.    strDisplay = ""
  127.    File1 = T2WFileTest
  128.    File2 = "autoexec.serialized"
  129.    strDisplay = strDisplay & "File Copy '" & File1 & "' to '" & File2 & "' is " & cFileCopy(File1, File2) & vbCrLf & vbCrLf
  130.    strDisplay = strDisplay & "File '" & File2 & "' is " & IIf(cIsSerial(File2) = True, "serialized", "not serialized") & vbCrLf & vbCrLf
  131.    putSD.Description1 = "T2WIN-32 demo"
  132.    putSD.Description2 = "Under the blue sky"
  133.    putSD.Number = 136
  134.    strDisplay = strDisplay & "Put/Modify '" & Trim$(putSD.Description1) & "' - '" & Trim$(putSD.Description2) & "' - '" & putSD.Number & "' into file '" & File2 & "' is " & IIf(cSerialPut(File2, putSD) = True, "OK", "KO") & vbCrLf & vbCrLf
  135.    intResult = cSerialGet(File2, getSD)
  136.    strDisplay = strDisplay & "Get from '" & File2 & "' is : " & vbCrLf
  137.    strDisplay = strDisplay & "  description 1 : " & Trim$(getSD.Description1) & vbCrLf
  138.    strDisplay = strDisplay & "  description 2 : " & Trim$(getSD.Description2) & vbCrLf
  139.    strDisplay = strDisplay & "  number : " & getSD.Number & vbCrLf & vbCrLf
  140.       
  141.    strDisplay = strDisplay & "Add 2 to serialized number part into file '" & File2 & "' is " & IIf(cSerialInc(File2, 2) = True, "OK", "KO") & vbCrLf & vbCrLf
  142.    intResult = cSerialGet(File2, getSD)
  143.    strDisplay = strDisplay & "Get from '" & File2 & "' is : " & vbCrLf
  144.    strDisplay = strDisplay & "  description 1 : " & Trim$(getSD.Description1) & vbCrLf
  145.    strDisplay = strDisplay & "  description 2 : " & Trim$(getSD.Description2) & vbCrLf
  146.    strDisplay = strDisplay & "  number : " & getSD.Number & vbCrLf & vbCrLf
  147.    strDisplay = strDisplay & "Substract 9 to serialized number part into file '" & File2 & "' is " & IIf(cSerialInc(File2, -9) = True, "OK", "KO") & vbCrLf & vbCrLf
  148.    intResult = cSerialGet(File2, getSD)
  149.    strDisplay = strDisplay & "Get from '" & File2 & "' is : " & vbCrLf
  150.    strDisplay = strDisplay & "  description 1 : " & Trim$(getSD.Description1) & vbCrLf
  151.    strDisplay = strDisplay & "  description 2 : " & Trim$(getSD.Description2) & vbCrLf
  152.    strDisplay = strDisplay & "  number : " & getSD.Number & vbCrLf & vbCrLf
  153.    strDisplay = strDisplay & "File '" & File2 & "' is " & IIf(cIsSerial(File2) = True, "serialized", "not serialized") & vbCrLf & vbCrLf
  154.    strDisplay = strDisplay & "Remove serialization in '" & File2 & "' is " & IIf(cSerialRmv(File2) = True, "unserialized", "not unserialized") & vbCrLf & vbCrLf
  155.    strDisplay = strDisplay & "File '" & File2 & "' is " & IIf(cIsSerial(File2) = True, "serialized", "not serialized") & vbCrLf & vbCrLf
  156.    txt_Result = strDisplay
  157.    'time the function
  158.    TimerHandle = cTimerOpen()
  159.    TimerStartOk = cTimerStart(TimerHandle)
  160.    For i = 1 To Iteration
  161.       intResult = cSerialGet(File2, getSD)
  162.    Next i
  163.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  164.    TimerCloseOk = cTimerClose(TimerHandle)
  165. End Sub
  166.